-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-128639: Don't assume one thread in subinterpreter finalization #128640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-128639: Don't assume one thread in subinterpreter finalization #128640
Conversation
Py_NewInterpreter(); | ||
Py_NewInterpreter(); | ||
Py_NewInterpreter(); | ||
PyThreadState *tstate = PyThreadState_Get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test working before was a fluke. Py_NewInterpreter
changes the thread state, and I don't think we support calling Py_Finalize
from a subinterpreter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably okay but your change helps future-proof the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly LGTM
There are a few things that might make more sense in a separate PR.
Py_NewInterpreter(); | ||
Py_NewInterpreter(); | ||
Py_NewInterpreter(); | ||
PyThreadState *tstate = PyThreadState_Get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably okay but your change helps future-proof the test.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Co-authored-by: Eric Snow <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for doing this!
@hugovk, is this something you'd be okay with us backporting to 3.14? |
Yep, crash bugfixes can be backported :) |
Thanks @ZeroIntensity for the PR, and @ericsnowcurrently for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…on (pythongh-128640) Incidentally, this also fixed the warning not showing up if a subinterpreter wasn't cleaned up via _interpreters.destroy. I had to update some of the tests as a result. (cherry picked from commit 9859791) Co-authored-by: Peter Bierma <[email protected]>
GH-134254 is a backport of this pull request to the 3.14 branch. |
|
…nalization (pythongh-128640)" This reverts commit 9859791.
Incidentally, this also fixed the warning not showing up if a subinterpreter wasn't cleaned up via
_interpreters.destroy
. I had to update some of the tests as a result.